﻿using Jinjia.Approve.Entity.Entity;
using Jinjia.Approve.IRepository.JJFlow;
using Jinjia.Approve.IService.JJFlow.Approvers;
using Jinjia.Core.BaseInfrastructure.StorageModel.RepositoryBase;
using System.Collections.Generic;
using System.Threading.Tasks;


namespace Jinjia.Approve.Service.JJFlow.Approvers
{
    public class CurrencyPurchaseApprovers : IJJApprovers
    {
        private readonly IRepositoryBase<erpa_base_tbl> _baseRepository;
        public CurrencyPurchaseApprovers(IRepositoryBase<erpa_base_tbl> baseRepository)
        {
            _baseRepository = baseRepository;
        }

        public async Task<List<int>> GetInstanceNodeEmpInfo(string biz_order_id, int start_user = 0, string depart_id = "0", Dictionary<string, string> dic = null)
        {
            var purchasingGroup = dic?.GetValueOrDefault("purchasing_group");

            var currencyPurchaseGroup = (await _baseRepository.GetFirstAsync(x => x.code_type == "currency_purchase_group" && x.value == purchasingGroup))?.create_user_id ?? -1;

            return new List<int> { currencyPurchaseGroup };
        }
    }
}
